package com.yc.cloud.common.websocket.core;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class SendMessageResult<T> {

    public static final int SUCCESS_CODE = 200;
    public static final int FAILED_CODE = 500;
    public static final String SUCCESS_MSG = "success";

    private int code;

    private String msg;

    private Object data;

    public static <T> SendMessageResult<T> success(T data) {
        return new SendMessageResult<>(SUCCESS_CODE, SUCCESS_MSG, data);
    }

    public static <T> SendMessageResult<T> failed(String message) {
        return new SendMessageResult<>(FAILED_CODE, message, null);
    }

}
